package my.test.factoryMethodPattern.staticFactory;

import my.test.factoryMethodPattern.Human;

public class HumanFactory {
    public static <T extends Human> T createHuman(Class<T> c) {
        //定义一个生产出的人种
        Human human = null;
        try {
            human = (Human) Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            System.out.println("人种生成错误!");
        }
        return (T) human;
    }
}
